<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
	</body>
	<script type="text/javascript">
		
		
		
		
		let arr = [2,5,6,1,7,8,9,2,6,-5];
		
		
		// for(let i = 0;i<arr.length;i++){
			
		// 	for(let j = i+1;j<arr.length;j++){
				
				
		// 		if(arr[i]>arr[j]){
					
					
		// 			[arr[i],arr[j]] = [arr[j],arr[i]]
		// 		}
		// 	}
			
			
		// }
		
		
		let max = 0;
		
		for(let i = 0;i<arr.length;i++){
			
			for(let j = i;j<arr.length;j++){
				
				
				if(arr[max]<arr[j]){
					
					max = j
				}
			}
			
			[arr[max],arr[i]] = [arr[i],arr[max]]
			
			
		}
		
		
		console.log(arr)
		
		
	</script>
</html>
